import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.List;

import javax.rmi.PortableRemoteObject;

/**
 * 
 * @author Bua_Pietro
 * 
 */
public class OrderImpl extends PortableRemoteObject implements Order {
	private List<Property> orders = new ArrayList<Property>();

	/**
	 * 
	 * @throws RemoteException
	 */
	public OrderImpl() throws RemoteException {
		super();
	}

	/**
	 * Order an item
	 */
	@Override
	public void orderItems(Property property) {
		try {
			orders.add(property);
			System.out.println("[OrderImpl > orderItems] \r\n" + "Ordered:"
					+ property.getMyKey() + " for " + property.getMyValue());
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	/**
	 * Get the ordered items
	 */
	@Override
	public List<Property> getOrders() {
		System.out.println("[OrderImpl > getOrders] " + orders);
		return orders;
	}

}
